<template>
  <div>
    今年
    <input type="text" v-model.number="age" />
    <div>明年{{ nextAge }}</div>
    后年
    <input type="text" v-model.number="nextnextAge" />
  </div>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue';

const age =    ref(19);
const nextAge = computed(() => {
  return age.value - 0 + 1;
});

const nextnextAge = computed({
  get() {
    return age.value + 2;
  },
  set(value: number) {
    age.value = value - 2;
  },
});
</script>

<style scoped></style>
